//
//  TransferTypeViewController.m
//  PigMarket
//
//  Created by mac on 2019/5/7.
//  Copyright © 2019 felix.pigmarket.oc. All rights reserved.
//

#import "TransferTypeViewController.h"
#import "HButtonView.h"
#import "TransferInfoViewController.h"

@interface TransferTypeViewController ()
/**
 transferTypeTitle
 */
@property (nonatomic , strong) UILabel *transferTypeTitle;
/**
 toTransferBtn
 */
@property (nonatomic , strong) HButtonView *toTransferBtn;
/**
 transferTips
 */
@property (nonatomic , strong) UILabel *transferTips;
/**
 putShopBtn
 */
@property (nonatomic , strong) HButtonView *putShopBtn;
/**
 putShopTips
 */
@property (nonatomic , strong) UILabel *putShopTips;
@end

@implementation TransferTypeViewController


#pragma mark - view life cycle
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"仔猪转让";
    [self setUpView];
}

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

-(void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
}

#pragma mark - init method
- (void)setUpView {
    [self initView];
    [self initLayout];
    [self initAction];
    [self initData];
}
- (void)initView {
    [self.view addSubview:self.transferTypeTitle];
    [self.view addSubview:self.toTransferBtn];
    [self.view addSubview:self.transferTips];
    [self.view addSubview:self.putShopBtn];
    [self.view addSubview:self.putShopTips];
}

- (void) initLayout {
    [self.transferTypeTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.top.mas_equalTo(46);
        make.height.mas_equalTo(22);
    }];
    [self.toTransferBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.top.mas_equalTo(self.transferTypeTitle.mas_bottom).offset(35);
        make.size.mas_equalTo(CGSizeMake(110, 140));
    }];
    [self.transferTips mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.toTransferBtn.mas_bottom).offset(6);
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.height.mas_equalTo(18);
    }];
    [self.putShopBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.top.mas_equalTo(self.transferTips.mas_bottom).offset(60);
        make.size.mas_equalTo(CGSizeMake(110, 140));
    }];
    [self.putShopTips mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.putShopBtn.mas_bottom).offset(6);
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.height.mas_equalTo(18);
    }];
    
}

- (void) initAction {
    @weakify(self);
    self.toTransferBtn.tapped = ^{
        @strongify(self);
        TransferInfoViewController *vc = [[TransferInfoViewController alloc] init];
        vc.adoptPigId = self.adoptPigId;
        [self.navigationController pushViewController:vc animated:YES];
    };
    self.putShopBtn.tapped = ^{
        @strongify(self);
    };
}

- (void)initData {
    
}

#pragma mark - delegate

#pragma mark - target action

#pragma mark - private method

#pragma mark - getter and setter
- (UILabel *)transferTypeTitle {
    if (!_transferTypeTitle) {
        _transferTypeTitle = [[UILabel alloc] init];
        _transferTypeTitle.textColor = [UIColor colorWithHexString:@"#9A9A9A"];
        _transferTypeTitle.font = [UIFont systemFontOfSize:15];
        _transferTypeTitle.text = @"请选择要转让的方式";
}
    return _transferTypeTitle;
}
- (HButtonView *)toTransferBtn {
    if (!_toTransferBtn) {
        UIImageView *iconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"adopted_totransfer"]];
        UILabel *titleLabel = [[UILabel alloc] init];
        titleLabel.text = @"去转让";
        titleLabel.font = [UIFont largerFont];
        titleLabel.textColor = [UIColor textBlackColor];
        
        _toTransferBtn = [[HButtonView alloc] initWithTopIcon:iconView title:titleLabel];
    }
    return _toTransferBtn;
}
- (UILabel *)transferTips {
    if (!_transferTips) {
        _transferTips = [[UILabel alloc] init];
        _transferTips.textColor = [UIColor tipsGrayColor];
        _transferTips.font = [UIFont systemFontOfSize:13];
        _transferTips.text = @"转让时间为3天，请在此时间内完成转让";
    }
    return _transferTips;
}
- (HButtonView *)putShopBtn {
    if (!_putShopBtn) {
        UIImageView *iconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"adopted_shop"]];
        UILabel *titleLabel = [[UILabel alloc] init];
        titleLabel.text = @"放入店铺";
        titleLabel.font = [UIFont largerFont];
        titleLabel.textColor = [UIColor textBlackColor];
        
        _putShopBtn = [[HButtonView alloc] initWithTopIcon:iconView title:titleLabel];
    }
    return _putShopBtn;
}
- (UILabel *)putShopTips {
    if (!_putShopTips) {
        _putShopTips = [[UILabel alloc] init];
        _putShopTips.textColor = [UIColor tipsGrayColor];
        _putShopTips.font = [UIFont systemFontOfSize:13];
        _putShopTips.text = @"放入店铺，默认直接开通“店铺”";
    }
    return _putShopTips;
}
@end
